[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
_open() Open a File For Reading or Writing
#include <fcntl.h>
#include <io.h>
int _open(pathname,access);
const char *pathname; Name of file
int access; Access mode
_open() opens the file specified by 'pathname', then prepares the
file for reading and/or writing as defined by 'access'. The value of
'access' is constructed by combining one of the following constants:
O_RDONLY Open for reading only
O_WRONLY Open for writing only
O_RDWR Open for reading and writing
with the following additional values (available with dos DOS 3.0 and
later):
O_NOINHERIT File cannot be passed to child programs
O_DENYALL Only the current handle has access to the file
O_DENYWRITE Any other open is allowed reads only
O_DENYREAD Any other open is allowed writes only
O_DENYNONE Other shared opens to the file are allowed
Under DOS 3.0 and later, only one of the O_DENYxxx values can be
included in a single _open(). These attributes are separate from any
file-locking operations.
Returns: On success, the file handle (a non-negative integer)
is returned and the file pointer to the current
position is set to the beginning of the file. On
error, -1 is returned and 'errno' (defined in
<errno.h>) is set to one of the following:
ENOENT Path or file name not found
EMFILE Too many open files
EACCES Permission denied
EINVACC Invalid access code
See Also:
creat()
dup()
fopen()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson